home *** CD-ROM | disk | FTP | other *** search
/ Australian Personal Computer 2002 November / CD 1 / APC0211D1.ISO / workshop / prog / files / ActivePerl-5.6.1.633-MSWin32.msi / _cc84e0ec8d9a3a808f071ab8ad24d585 < prev    next >
Encoding:
Text File  |  2002-05-24  |  23.7 KB  |  641 lines

  1. # ======================================================================
  2. #
  3. # Copyright (C) 2000-2001 Paul Kulchenko (paulclinger@yahoo.com)
  4. # SOAP::Lite is free software; you can redistribute it
  5. # and/or modify it under the same terms as Perl itself.
  6. #
  7. # $Id: Lite.pm,v 1.6 2001/09/03 03:58:30 paulk Exp $
  8. #
  9. # ======================================================================
  10.  
  11. package UDDI::Lite;
  12.  
  13. use 5.004;
  14. use strict;
  15. use vars qw($VERSION);
  16. $VERSION = sprintf("%d.%s", map {s/_//g; $_} q$Name: release-0_55-public $ =~ /-(\d+)_([\d_]+)/);
  17.  
  18. use SOAP::Lite;
  19.  
  20. # ======================================================================
  21.  
  22. package UDDI::SOM;
  23.  
  24. use vars qw(@ISA);
  25. @ISA = qw(SOAP::SOM);
  26.  
  27. sub result { # result should point to immediate child of Body
  28.   my $self = shift;
  29.   my $result = '/Envelope/Body/[1]'; 
  30.   ref $self or return $result;
  31.   defined $self->fault ? undef : $self->valueof($result);
  32. };
  33.  
  34. # ======================================================================
  35.  
  36. package UDDI::Data;
  37.  
  38. use Carp ();
  39.  
  40. use vars qw(@ISA $AUTOLOAD @EXPORT_OK %EXPORT_TAGS);
  41. @ISA = qw(SOAP::Data);
  42.  
  43. my @elements = (with => qw/accessPoint address addressLine authInfo authToken bindingDetail bindingKey bindingTemplate bindingTemplates businessDetail businessDetailExt businessEntity businessEntityExt businessInfo businessInfos businessKey businessList businessService businessServices categoryBag contact contacts description discoveryURL discoveryURLs dispositionReport email errInfo findQualifier findQualifiers hostingRedirector identifierBag instanceDetails instanceParms keyValue keyedReference name overviewDoc overviewURL personName phone registeredInfo result serviceDetail serviceInfo serviceInfos serviceKey serviceList tModel tModelBag tModelDetail tModelInfo tModelInfos tModelInstanceDetails tModelInstanceInfo tModelKey tModelList uploadRegister/);
  44. @EXPORT_OK = (@elements);
  45. %EXPORT_TAGS = ('all' => [@EXPORT_OK]);
  46.  
  47. use overload fallback => 1, '""' => sub { shift->SUPER::value };
  48.  
  49. use vars qw(%elements %attributes);
  50. %elements = (get_serviceDetail=>{serviceKey=>1},find_tModel=>{categoryBag=>1,name=>1,identifierBag=>1,findQualifiers=>1},tModelInstanceInfo=>{instanceDetails=>1,description=>1},address=>{addressLine=>1},categoryBag=>{keyedReference=>1},save_binding=>{authInfo=>1,bindingTemplate=>1},businessEntity=>{categoryBag=>1,businessServices=>1,name=>1,description=>1,identifierBag=>1,discoveryURLs=>1,contacts=>1},businessInfos=>{businessInfo=>1},find_business=>{categoryBag=>1,name=>1,identifierBag=>1,discoveryURLs=>1,findQualifiers=>1,tModelBag=>1},get_bindingDetail=>{bindingKey=>1},identifierBag=>{keyedReference=>1},get_businessDetailExt=>{businessKey=>1},businessServices=>{businessService=>1},tModelInfo=>{name=>1},find_service=>{categoryBag=>1,name=>1,findQualifiers=>1,tModelBag=>1},dispositionReport=>{result=>1},authToken=>{authInfo=>1},get_tModelDetail=>{tModelKey=>1},delete_tModel=>{tModelKey=>1,authInfo=>1},bindingTemplate=>{tModelInstanceDetails=>1,accessPoint=>1,description=>1,hostingRedirector=>1},tModelDetail=>{tModel=>1},businessInfo=>{serviceInfos=>1,name=>1,description=>1},get_registeredInfo=>{authInfo=>1},businessEntityExt=>{businessEntity=>1},registeredInfo=>{businessInfos=>1,tModelInfos=>1},find_binding=>{findQualifiers=>1,tModelBag=>1},serviceInfo=>{name=>1},get_businessDetail=>{businessKey=>1},delete_business=>{businessKey=>1,authInfo=>1},discoveryURLs=>{discoveryURL=>1},businessDetail=>{businessEntity=>1},contacts=>{contact=>1},tModelInstanceDetails=>{tModelInstanceInfo=>1},tModelList=>{tModelInfos=>1},delete_service=>{serviceKey=>1,authInfo=>1},tModelInfos=>{tModelInfo=>1},serviceDetail=>{businessService=>1},tModel=>{categoryBag=>1,name=>1,description=>1,identifierBag=>1,overviewDoc=>1},businessList=>{businessInfos=>1},bindingTemplates=>{bindingTemplate=>1},validate_categorization=>{businessEntity=>1,tModel=>1,businessService=>1,keyValue=>1,tModelKey=>1},contact=>{email=>1,personName=>1,phone=>1,description=>1,address=>1},discard_authToken=>{authInfo=>1},overviewDoc=>{overviewURL=>1,description=>1},delete_binding=>{bindingKey=>1,authInfo=>1},serviceList=>{serviceInfos=>1},bindingDetail=>{bindingTemplate=>1},tModelBag=>{tModelKey=>1},businessDetailExt=>{businessEntityExt=>1},serviceInfos=>{serviceInfo=>1},save_tModel=>{uploadRegister=>1,tModel=>1,authInfo=>1},findQualifiers=>{findQualifier=>1},save_business=>{businessEntity=>1,uploadRegister=>1,authInfo=>1},instanceDetails=>{instanceParms=>1,description=>1,overviewDoc=>1},businessService=>{categoryBag=>1,name=>1,bindingTemplates=>1,description=>1},save_service=>{businessService=>1,authInfo=>1},result=>{errInfo=>1});
  51. %attributes = (get_serviceDetail=>{generic=>2},find_tModel=>{maxRows=>2,generic=>2},tModelInstanceInfo=>{tModelKey=>2},address=>{sortCode=>2,useType=>2},email=>{useType=>2},save_binding=>{generic=>2},businessEntity=>{authorizedName=>2,operator=>2,businessKey=>2},discoveryURL=>{useType=>2},find_business=>{maxRows=>2,generic=>2},get_bindingDetail=>{generic=>2},get_businessDetailExt=>{generic=>2},tModelInfo=>{tModelKey=>2},find_service=>{maxRows=>2,businessKey=>2,generic=>2},dispositionReport=>{truncated=>2,operator=>2,generic=>2},authToken=>{operator=>2,generic=>2},get_tModelDetail=>{generic=>2},bindingTemplate=>{serviceKey=>2,bindingKey=>2},delete_tModel=>{generic=>2},tModelDetail=>{truncated=>2,operator=>2,generic=>2},businessInfo=>{businessKey=>2},get_registeredInfo=>{generic=>2},registeredInfo=>{truncated=>2,operator=>2,generic=>2},phone=>{useType=>2},find_binding=>{maxRows=>2,serviceKey=>2,generic=>2},serviceInfo=>{serviceKey=>2,businessKey=>2},get_businessDetail=>{generic=>2},delete_business=>{generic=>2},businessDetail=>{truncated=>2,operator=>2,generic=>2},keyedReference=>{keyName=>2,keyValue=>2,tModelKey=>2},tModelList=>{truncated=>2,operator=>2,generic=>2},delete_service=>{generic=>2},serviceDetail=>{truncated=>2,operator=>2,generic=>2},tModel=>{authorizedName=>2,operator=>2,tModelKey=>2},businessList=>{truncated=>2,operator=>2,generic=>2},validate_categorization=>{generic=>2},contact=>{useType=>2},discard_authToken=>{generic=>2},delete_binding=>{generic=>2},serviceList=>{truncated=>2,operator=>2,generic=>2},bindingDetail=>{truncated=>2,operator=>2,generic=>2},hostingRedirector=>{bindingKey=>2},businessDetailExt=>{truncated=>2,operator=>2,generic=>2},get_authToken=>{userID=>2,generic=>2,cred=>2},save_tModel=>{generic=>2},errInfo=>{errCode=>2},save_business=>{generic=>2},accessPoint=>{URLType=>2},businessService=>{serviceKey=>2,businessKey=>2},save_service=>{generic=>2},result=>{keyType=>2,errno=>2});
  52.  
  53. sub new {
  54.   my $self = shift;
  55.   my $class = ref($self) || $self;
  56.  
  57.   unless (ref $self) {
  58.     $self = $class->SUPER::new(@_, type => 'uddi');
  59.   }
  60.   return $self;
  61. }
  62.  
  63. sub with {
  64.   my $self = shift;
  65.   $self = (__PACKAGE__->can($self) || Carp::croak "Don't know what to do with '$self'")->()
  66.     unless ref $self && UNIVERSAL::isa($self => __PACKAGE__);
  67.  
  68.   my $name = $self->SUPER::name;
  69.   my @values;
  70.   while (@_) {
  71.     my $data = shift;
  72.     my($method, @value) = UNIVERSAL::isa($data => __PACKAGE__)
  73.       ? ($data->SUPER::name, $data->value)
  74.       : ($data, shift);
  75.     exists $attributes{$name}{$method}
  76.       ? $self->$method(@value)
  77.       : push(@values, ($self->can($method) || Carp::croak "Don't know what to do with '$method'")->(@value));
  78.   }
  79.   $self->set_value([@values]);
  80. }
  81.  
  82. sub _compileit {
  83.   no strict 'refs';
  84.   my $method = shift;
  85.   *$method = sub { 
  86.  
  87.     # GENERATE element if no parameters: businessInfo()
  88.     return __PACKAGE__->SUPER::name($method) 
  89.       if !@_ && exists $elements{$method};
  90.  
  91.     die "Expected element (UDDI::Data) as parameter for $method()\n"
  92.       if !ref $_[0] && exists $elements{$method};
  93.  
  94.     my $uddi = UNIVERSAL::isa($_[0] => __PACKAGE__);
  95.  
  96.     # MAKE ELEMENT: name('old')
  97.     return __PACKAGE__->SUPER::name($method => @_) 
  98.       if !$uddi;
  99.  
  100.     my $name = $_[0]->SUPER::name;
  101.  
  102.     # GET/SET ATTRIBUTE: businessInfo->businessKey
  103.     return @_ > 1 
  104.         ? scalar($_[0]->attr->{$method} = $_[1], $_[0])               # SET
  105.         : __PACKAGE__->SUPER::name($method => $_[0]->attr->{$method}) # GET
  106.       if exists $attributes{$name} && exists $attributes{$name}{$method};
  107.  
  108.     # GET ELEMENT: businessInfos->businessInfo
  109.     my @elems = grep {
  110.       ref $_ && UNIVERSAL::isa($_ => __PACKAGE__) && $_->SUPER::name eq $method
  111.     } map {ref $_ eq 'ARRAY' ? @$_ : $_} $_[0]->value;
  112.     return wantarray? @elems : $elems[0]
  113.       if exists $elements{$name} && exists $elements{$name}{$method};
  114.  
  115.     # MAKE ELEMENT: businessInfos(businessInfo('something'))
  116.     return __PACKAGE__->SUPER::name($method => @_) 
  117.       if exists $elements{$method} && exists $elements{$method}{$name};
  118.  
  119.     Carp::croak "Don't know what to do with '$method' and '$name' elements";
  120.   }
  121. }
  122.  
  123. sub BEGIN { _compileit('name') }
  124.  
  125. sub AUTOLOAD {
  126.   my $method = substr($AUTOLOAD, rindex($AUTOLOAD, '::') + 2);
  127.   return if $method eq 'DESTROY';
  128.  
  129.   _compileit($method);
  130.   goto &$AUTOLOAD;
  131. }
  132.  
  133. # ======================================================================
  134.  
  135. package UDDI::Serializer;
  136.  
  137. use vars qw(@ISA);
  138. @ISA = qw(SOAP::Serializer);
  139.  
  140. sub new { 
  141.   my $self = shift;
  142.   my $class = ref($self) || $self;
  143.  
  144.   unless (ref $self) {
  145.     $self = $class->SUPER::new(
  146.       attr => {},
  147.       namespaces => {
  148.         $SOAP::Constants::PREFIX_ENV ? ($SOAP::Constants::NS_ENV => $SOAP::Constants::PREFIX_ENV) : (),
  149.       },
  150.       autotype => 0,
  151.       @_,
  152.     );
  153.   }
  154.   return $self;
  155. }
  156.  
  157. use overload; # protect from stringification in UDDI::Data
  158. sub gen_id { overload::StrVal($_[1]) =~ /\((0x\w+)\)/o; $1 }
  159.  
  160. sub as_uddi { 
  161.   my $self = shift;
  162.   my($value, $name, $type, $attr) = @_;
  163.   return $self->encode_array($value, $name, undef, $attr) if ref $value eq 'ARRAY';
  164.   return $self->encode_hash($value, $name, undef, $attr) if ref $value eq 'HASH';
  165.   [$name, {%{$attr || {}}}, ref $value ? ([$self->encode_object($value)], $self->gen_id($value)) : $value];
  166. }                                                                                          
  167.  
  168. sub encode_array {
  169.   my $self = shift;
  170.   my $encoded = $self->SUPER::encode_array(@_);
  171.   delete $encoded->[1]->{SOAP::Utils::qualify($self->encprefix => 'arrayType')};
  172.   return $encoded;
  173. }
  174.  
  175. # ======================================================================
  176.  
  177. package UDDI::Deserializer;
  178.  
  179. use vars qw(@ISA);
  180. @ISA = qw(SOAP::Deserializer);
  181.  
  182. sub decode_value {
  183.   my $self = shift;
  184.   my $ref = shift;
  185.   my($name, $attrs, $children, $value) = @$ref;
  186.  
  187.   # base class knows what to do with elements in SOAP namespace
  188.   return $self->SUPER::decode_value($ref) 
  189.     if exists $attrs->{href} || 
  190.        (SOAP::Utils::splitlongname($name))[0] eq $SOAP::Constants::NS_ENV;
  191.  
  192.   UDDI::Data
  193.     -> SOAP::Data::name($name)
  194.     -> attr($attrs)
  195.     -> set_value(ref $children && @$children ? map(scalar(($self->decode_object($_))[1]), @$children) : $value);
  196. }
  197.  
  198. sub deserialize {
  199.   bless shift->SUPER::deserialize(@_) => 'UDDI::SOM';
  200. }
  201.  
  202. # ======================================================================
  203.  
  204. package UDDI::Lite;
  205.  
  206. use vars qw(@ISA $AUTOLOAD %EXPORT_TAGS);
  207. use Exporter;
  208. use Carp ();
  209. @ISA = qw(SOAP::Lite Exporter);
  210.  
  211. BEGIN { # handle exports
  212.   %EXPORT_TAGS = (
  213.     'delete'   => [qw/delete_binding delete_business delete_service delete_tModel/],
  214.     'auth'     => [qw/get_authToken discard_authToken get_registeredInfo/],
  215.     'save'     => [qw/save_binding save_business save_service save_tModel/],
  216.     'validate' => [qw/validate_categorization/],
  217.     'find'     => [qw/find_binding find_business find_service find_tModel/],
  218.     'get'      => [qw/get_bindingDetail get_businessDetail get_businessDetailExt get_serviceDetail get_tModelDetail/],
  219.   );
  220.   $EXPORT_TAGS{inquiry} = [map {@{$EXPORT_TAGS{$_}}} qw/find get/];
  221.   $EXPORT_TAGS{publish} = [map {@{$EXPORT_TAGS{$_}}} qw/delete auth save validate/];
  222.   $EXPORT_TAGS{all} =     [map {@{$EXPORT_TAGS{$_}}} qw/inquiry publish/];
  223.   Exporter::export_ok_tags('all');
  224. }
  225.  
  226. sub new { 
  227.   my $self = shift;
  228.   my $class = ref($self) || $self;
  229.  
  230.   unless (ref $self) {
  231.     $self = $class->SUPER::new(
  232.       on_action    => sub {'""'},
  233.       serializer   => UDDI::Serializer->new,   # register UDDI Serializer
  234.       deserializer => UDDI::Deserializer->new, # and Deserializer
  235.       @_,
  236.     );
  237.   }
  238.   return $self;
  239. }
  240.  
  241. sub AUTOLOAD {
  242.   my $method = substr($AUTOLOAD, rindex($AUTOLOAD, '::') + 2);
  243.   return if $method eq 'DESTROY';
  244.  
  245.   no strict 'refs';
  246.   *$AUTOLOAD = sub { 
  247.     return shift->call($method => @_) if UNIVERSAL::isa($_[0] => __PACKAGE__);
  248.     my $som = (__PACKAGE__->self || Carp::croak "Method call on unspecified object. Died")->call($method => @_);
  249.     UNIVERSAL::isa($som => 'SOAP::SOM') ? $som->result : $som;
  250.   };
  251.   goto &$AUTOLOAD;
  252. }
  253.  
  254. sub call { SOAP::Trace::trace('()'); 
  255.   my $self = shift;
  256.   my $method = shift;
  257.   my @parameters;
  258.   my $attr = ref $_[0] eq 'HASH' ? shift() : {};
  259.   while (@_) {
  260.     push(@parameters, UNIVERSAL::isa($_[0] => 'UDDI::Data') 
  261.       ? shift : SOAP::Data->name(shift, shift));
  262.   }
  263.   my $message = SOAP::Data
  264.     -> name($method => \SOAP::Data->value(@parameters))
  265.     -> attr({xmlns=>'urn:uddi-org:api', generic => '1.0', %$attr});
  266.  
  267.   my $serializer = $self->serializer;
  268.   $serializer->on_nonserialized($self->on_nonserialized);
  269.  
  270.   my $respond = $self->transport->send_receive(
  271.     endpoint => $self->endpoint, 
  272.     action   => $self->on_action->($self->uri),
  273.     envelope => $serializer->envelope(freeform => $message), 
  274.     encoding => $serializer->encoding,
  275.   );
  276.  
  277.   return $respond if $self->outputxml;
  278.  
  279.   unless ($self->transport->is_success) {
  280.     my $result = eval { $self->deserializer->deserialize($respond) } if $respond;
  281.     return $self->on_fault->($self, $@ ? $respond : $result) || $result;
  282.   }
  283.  
  284.   return unless $respond; # nothing to do for one-ways
  285.   return $self->deserializer->deserialize($respond);
  286. }
  287.  
  288. # ======================================================================
  289.  
  290. 1;
  291.  
  292. __END__
  293.  
  294. =head1 NAME
  295.  
  296. UDDI::Lite - Library for UDDI clients in Perl
  297.  
  298. =head1 SYNOPSIS
  299.  
  300.   use UDDI::Lite;
  301.   print UDDI::Lite
  302.     -> proxy('http://uddi.microsoft.com/inquire')
  303.     -> find_business(name => 'old')
  304.     -> result
  305.     -> businessInfos->businessInfo->serviceInfos->serviceInfo->name;
  306.  
  307. The same code with autodispatch: 
  308.  
  309.   use UDDI::Lite +autodispatch => 
  310.     proxy => 'http://uddi.microsoft.com/inquire'
  311.   ;
  312.  
  313.   print find_business(name => 'old')
  314.     -> businessInfos->businessInfo->serviceInfos->serviceInfo->name;                         
  315.  
  316. Or with importing:
  317.  
  318.   use UDDI::Lite 
  319.     'UDDI::Lite' => [':inquiry'],
  320.     proxy => 'http://uddi.microsoft.com/inquire'
  321.   ;
  322.  
  323.   print find_business(name => 'old')
  324.     -> businessInfos->businessInfo->serviceInfos->serviceInfo->name;                         
  325.  
  326. Publishing API:
  327.  
  328.   use UDDI::Lite 
  329.     import => ['UDDI::Data'], 
  330.     import => ['UDDI::Lite'],
  331.     proxy => "https://some.server.com/endpoint_fot_publishing_API";
  332.  
  333.   my $auth = get_authToken({userID => 'USERID', cred => 'CRED'})->authInfo;
  334.   my $busent = with businessEntity =>
  335.     name("Contoso Manufacturing"), 
  336.     description("We make components for business"),
  337.     businessKey(''),
  338.     businessServices with businessService =>
  339.       name("Buy components"), 
  340.       description("Bindings for buying our components"),
  341.       serviceKey(''),
  342.       bindingTemplates with bindingTemplate =>
  343.         description("BASDA invoices over HTTP post"),
  344.         accessPoint('http://www.contoso.com/buy.asp'),
  345.         bindingKey(''),
  346.         tModelInstanceDetails with tModelInstanceInfo =>
  347.           description('some tModel'),
  348.           tModelKey('UUID:C1ACF26D-9672-4404-9D70-39B756E62AB4')
  349.   ;
  350.   print save_business($auth, $busent)->businessEntity->businessKey;
  351.  
  352. =head1 DESCRIPTION
  353.  
  354. UDDI::Lite for Perl is a collection of Perl modules which provides a 
  355. simple and lightweight interface to the Universal Description, Discovery
  356. and Integration (UDDI) server.
  357.  
  358. To learn more about UDDI, visit http://www.uddi.org/.
  359.  
  360. The main features of the library are:
  361.  
  362. =over 3
  363.  
  364. =item *
  365.  
  366. Supports both inquiry and publishing API 
  367.  
  368. =item *
  369.  
  370. Builded on top of SOAP::Lite module, hence inherited syntax and features
  371.  
  372. =item *
  373.  
  374. Supports easy-to-use interface with convinient access to (sub)elements
  375. and attributes
  376.  
  377. =item *
  378.  
  379. Supports HTTPS protocol
  380.  
  381. =item *
  382.  
  383. Supports SMTP protocol
  384.  
  385. =item *
  386.  
  387. Supports Basic/Digest server authentication
  388.  
  389. =back
  390.  
  391. =head1 OVERVIEW OF CLASSES AND PACKAGES
  392.  
  393. This table should give you a quick overview of the classes provided by the
  394. library.
  395.  
  396.  UDDI::Lite.pm
  397.  -- UDDI::Lite         -- Main class provides all logic
  398.  -- UDDI::Data         -- Provides extensions for serialization architecture
  399.  -- UDDI::Serializer   -- Serializes data structures to UDDI/SOAP package
  400.  -- UDDI::Deserializer -- Deserializes result into objects
  401.  -- UDDI::SOM          -- Provides access to deserialized object tree
  402.  
  403. =head2 UDDI::Lite
  404.  
  405. All methods that UDDI::Lite gives you access to can be used for both
  406. setting and retrieving values. If you provide no parameters, you'll
  407. get current value, and if you'll provide parameter(s), new value
  408. will be assigned and method will return object (if not stated something
  409. else). This is suitable for stacking these calls like:
  410.  
  411.   $uddi = UDDI::Lite
  412.     -> on_debug(sub{print@_})
  413.     -> proxy('http://uddi.microsoft.com/inquire')
  414.   ;
  415.  
  416. Order is insignificant and you may call new() method first. If you
  417. don't do it, UDDI::Lite will do it for you. However, new() method
  418. gives you additional syntax:
  419.  
  420.   $uddi = new UDDI::Lite
  421.     on_debug => sub {print@_},
  422.     proxy => 'http://uddi.microsoft.com/inquire'
  423.   ;
  424.  
  425. new() accepts hash with method names and values, and will call 
  426. appropriate method with passed value.
  427.  
  428. Since new() is optional it won't be mentioned anymore.
  429.  
  430. Other available methods inherited from SOAP::Lite and most usable are:
  431.  
  432. =over 4
  433.  
  434. =item proxy()
  435.  
  436. Shortcut for C<transport-E<gt>proxy()>. This lets you specify an endpoint and 
  437. also loads the required module at the same time. It is required for dispatching SOAP 
  438. calls. The name of the module will be defined depending on the protocol 
  439. specific for the endpoint. SOAP::Lite will do the rest work.
  440.  
  441. =item on_fault()
  442.  
  443. Lets you specify handler for on_fault event. Default behavior is die 
  444. on transport error and does nothing on others. You can change this 
  445. behavior globally or locally, for particular object.
  446.  
  447. =item on_debug()
  448.  
  449. Lets you specify handler for on_debug event. Default behavior is do 
  450. nothing. Use +trace/+debug option for UDDI::Lite instead.
  451.  
  452. =back
  453.  
  454. =head2 UDDI::Data
  455.  
  456. You can use this class if you want to specify value and name for UDDI 
  457. elements. 
  458. For example, C<UDDI::Data-E<gt>name('businessInfo')-E<gt>value(123)> will 
  459. be serialized to C<E<lt>businessInfoE<gt>123E<lt>/businessInfoE<gt>>, as 
  460. well as C<UDDI::Data->name(businessInfo =E<gt> 123)>.
  461.  
  462. If you want to provide names for your parameters you can either specify
  463.  
  464.   find_business(name => 'old')
  465.  
  466. or do it with UDDI::Data:
  467.  
  468.   find_business(UDDI::Data->name(name => 'old'))
  469.  
  470. Later has some advantages: it'll work on any level, so you can do:
  471.  
  472.   find_business(UDDI::Data->name(name => UDDI::Data->name(subname => 'old')))
  473.  
  474. and also you can create arrays with this syntax:
  475.                          
  476.   find_business(UDDI::Data->name(name => 
  477.     [UDDI::Data->name(subname1 => 'name1'), 
  478.      UDDI::Data->name(subname2 => 'name2')]))
  479.  
  480. will be serialized into:
  481.  
  482.   <find_business xmlns="urn:uddi-org:api" generic="1.0">
  483.     <name>
  484.       <subname1>name1</subname1>
  485.       <subname2>name2</subname2>
  486.     </name>
  487.   </find_business>
  488.  
  489. For standard elements more convinient syntax is available:
  490.  
  491.   find_business(
  492.     findQualifiers(findQualifier('sortByNameAsc',
  493.                                  'caseSensitiveMatch')),
  494.     name('M')
  495.   )
  496.  
  497. and
  498.  
  499.   find_business(
  500.     findQualifiers([findQualifier('sortByNameAsc'), 
  501.                     findQualifier('caseSensitiveMatch')]), 
  502.     name('M')
  503.   )
  504.  
  505. both will generate:
  506.  
  507.   <SOAP-ENV:Envelope 
  508.     xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
  509.     <SOAP-ENV:Body>
  510.       <find_business xmlns="urn:uddi-org:api" generic="1.0">
  511.         <findQualifiers>
  512.           <findQualifier>sortByNameAsc</findQualifier>
  513.           <findQualifier>caseSensitiveMatch</findQualifier>
  514.         </findQualifiers>
  515.         <name>M</name>
  516.       </find_business>
  517.     </SOAP-ENV:Body>
  518.   </SOAP-ENV:Envelope>
  519.  
  520. You can use ANY valid combinations (according to "UDDI Programmer's 
  521. API Specification"). If you try to generate something unusual, like 
  522. C<name(name('myname'))>, you'll get:
  523.  
  524.   Don't know what to do with 'name' and 'name' elements ....
  525.  
  526. If you REALLY need to do it, use C<UDDI::Data> syntax described above.
  527.  
  528. As special case you can pass hash as the first parameter of method
  529. call and values of this hash will be added as attributes to top element:
  530.  
  531.   find_business({maxRows => 10}, UDDI::Data->name(name => old))
  532.  
  533. gives you
  534.  
  535.   <find_business xmlns="urn:uddi-org:api" generic="1.0" maxRows="10">
  536.     ....
  537.   </find_business>
  538.  
  539. You can also pass back parameters exactly as you get it from method call
  540. (like you probably want to do with authInfo).
  541.  
  542. You can get access to attributes and elements through the same interface:
  543.  
  544.   my $list = find_business(name => old);
  545.   my $bis = $list->businessInfos;
  546.   for ($bis->businessInfo) {
  547.     my $s = $_->serviceInfos->serviceInfo;
  548.     print $s->name,        # element
  549.           $s->businessKey, # attribute
  550.           "\n";
  551.   }
  552.  
  553. To match advantages provided by C<with> operator available in other 
  554. languages (like VB) we provide similar functionality that adds you 
  555. flexibility:
  556.  
  557.     with findQualifiers => 
  558.       findQualifier => 'sortByNameAsc',
  559.       findQualifier => 'caseSensitiveMatch'
  560.  
  561. is the same as: 
  562.  
  563.     with(findQualifiers => 
  564.       findQualifier('sortByNameAsc'),
  565.       findQualifier('caseSensitiveMatch'),
  566.     )
  567.  
  568. and:
  569.  
  570.     findQualifiers->with( 
  571.       findQualifier('sortByNameAsc'),
  572.       findQualifier('caseSensitiveMatch'),
  573.     )
  574.  
  575. will all generate the same code as mentioned above:
  576.  
  577.     findQualifiers(findQualifier('sortByNameAsc',
  578.                                  'caseSensitiveMatch')),
  579.  
  580. Advantage of C<with> syntax is the you can specify both attributes and 
  581. elements through the same interface. First argument is element where all 
  582. other elements and attributes will be attached. Provided examples and 
  583. tests cover different syntaxes.
  584.  
  585. =head2 AUTODISPATCHING
  586.  
  587. UDDI::Lite provides autodispatching feature that lets you create 
  588. code that looks similar for local and remote access.
  589.  
  590. For example:
  591.  
  592.   use UDDI::Lite +autodispatch => 
  593.     proxy => 'http://uddi.microsoft.com/inquire';
  594.  
  595. tells autodispatch all UDDI calls to 
  596. 'http://uddi.microsoft.com/inquire'. All subsequent calls can look 
  597. like:
  598.  
  599.   find_business(name => 'old');
  600.   find_business(UDDI::Data->name(name => 'old'));
  601.   find_business(name('old'));
  602.  
  603. =head1 BUGS AND LIMITATIONS
  604.  
  605. =over 4
  606.  
  607. =item *
  608.  
  609. Interface is still subject to change.
  610.  
  611. =item *
  612.  
  613. Though HTTPS/SSL is supported you should specify it yourself (with 
  614. C<proxy> or C<endpoint>) for publishing API calls.
  615.  
  616. =back
  617.  
  618. =head1 AVAILABILITY
  619.  
  620. For now UDDI::Lite is distributed as part of SOAP::Lite package.
  621. You can download it from ( http://soaplite.com/ ) 
  622. or from CPAN ( http://search.cpan.org/search?dist=SOAP-Lite ).  
  623.  
  624. =head1 SEE ALSO
  625.  
  626. L<SOAP::Lite> ( http://search.cpan.org/search?dist=SOAP-Lite )
  627. L<UDDI> ( http://search.cpan.org/search?dist=UDDI )
  628.  
  629. =head1 COPYRIGHT
  630.  
  631. Copyright (C) 2000-2001 Paul Kulchenko. All rights reserved.
  632.  
  633. This library is free software; you can redistribute it and/or modify
  634. it under the same terms as Perl itself.
  635.  
  636. =head1 AUTHOR
  637.  
  638. Paul Kulchenko (paulclinger@yahoo.com)
  639.  
  640. =cut
  641.